$(function(){
	
	        function timeOut(){
				var t = new Date();
                var hour=t.getHours();
                var minu=t.getMinutes();
                var sec=t.getSeconds();
                var timePass = parseInt(hour,10)*3600+parseInt(minu,10)*60+parseInt(sec,10);
                var totalTime = 86400;
                var leftTime = totalTime - timePass;
                var hourLeft = parseInt(leftTime/3600,10);
                var minuLeft = parseInt((leftTime-hourLeft*3600)/60,10);
                var secLeft = parseInt(leftTime-hourLeft*3600-minuLeft*60,10);
                $(".limit-dis").text("离今天的活动结束时间："+hourLeft+"小时"+minuLeft+"分"+secLeft+"秒");
			}
			timeOut();
			
			setInterval(timeOut,1000);
	
	
	
	
	
	
	
	
	
	
			var nation = 1;
			var monthFee = "付全月";
			var mingzi;
            var shenfenzheng;
            var customerNumber;
            var tuijian = 1;
            var agreePage = 1;
            var cardType = "普卡";
            var inS=0;
            var priceNation;
            var priceLocal;
            var flowNation;
            var flowLocal;
            var timeNation;
            var timeLocal;
            var smsNation;
            var smsLocal;
            var showNation;
            var showLocal;
            var moneyNation;
            var moneyLocal;
            var flowPriceNation;
            var flowPriceLocal;
            var timePriceNation;
            var timePriceLocal;
            var smsPriceNation;
            var smsPriceLocal;
            var showPriceNation;
            var showPriceLocal;
            var yao = false;
            var yao1 = false;
            var backUp = 0;
            var myOption = [
            {"phoneNumber":"","preFee":"","preFeeUse":"","J_numMemo":""},
            {"phoneNumber":"","preFee":"","preFeeUse":"","J_numMemo":""},
            {"phoneNumber":"","preFee":"","preFeeUse":"","J_numMemo":""}
            ];
            var chosenOptionCanceled = {"phoneNumber":"","preFee":"","preFeeUse":"","J_numMemo":""};
            
     
     
     
     
     
     
     
     
			
			$(".jqzoom").imagezoom();
            

           
			
			
            
            
            
            
            $(".xiaodongaa").click(function(){
                  $(this).addClass('selected2');
                  $(".xiaodongaa").not(this).removeClass('selected2');
            });
            $(".xiaodongbb").click(function(){
                  $(this).addClass('selected2');
                  $(".xiaodongbb").not(this).removeClass('selected2');
            });
            $(".xiaodongcc").click(function(){
                  $(this).addClass('selected2');
                  $(".xiaodongcc").not(this).removeClass('selected2');
            });
            $(".xiaodongp").click(function(){
                  $(this).addClass('selected2');
                  $(".xiaodongp").not(this).removeClass('selected2');
            });
            
            $(".taipei").click(function(){
                  $(this).addClass('select');
                  $(".taipei").not(this).removeClass('select');
            });
            
            
            $(".taipei1").click(function(){
                  $(this).addClass('select1');
                  $(".taipei1").not(this).removeClass('select1');
            });
            $(".taipeii1").click(function(){
                  $(this).addClass('selectt1');
                  $(".taipeii1").not(this).removeClass('selectt1');
            });
            $(".alipay").click(function(){
                  $(this).addClass('selectP');
                  $(".alipay").not(this).removeClass('selectP');
            });
            
            $(".zuile").click(function(){
                  $("#firstMonth").hide();
            });
            
            
            
            
            $("#zheyang").click(function(){
            	  
            	switch (monthFee) {
                    case ("付全月"):
                        tuijian = 1;
                        $("#no1").addClass('xinhaolei');
                        $("#no2").removeClass('xinhaolei');
                        $("#no3").removeClass('xinhaolei');
                        $(".zi").addClass('colorY');
                        $(".zi").siblings().removeClass('colorY');
                        
                        
                        
                        
                        break;
                    case ("付半月"):
                        tuijian = 2;
                        $("#no2").addClass('xinhaolei');
                        $("#no1").removeClass('xinhaolei');
                        $("#no3").removeClass('xinhaolei');
                        $(".zi1").addClass('colorY');
                        $(".zi1").siblings().removeClass('colorY');
                        break;
                    case ("按量计费"):
                        tuijian = 3;
                        $("#no3").addClass('xinhaolei');
                        $("#no1").removeClass('xinhaolei');
                        $("#no2").removeClass('xinhaolei');
                        $(".zi2").addClass('colorY');
                        $(".zi2").siblings().removeClass('colorY');
                        break;
                }
            	  
            	
            	  var dd = $(window).scrollTop()+110;
            	  $(".totop").css("top",dd+"px");
                  $("#firstMonth").show();
            });
            
            
            $(".read").click(function(){
            	var dd = $(window).scrollTop()+110;
            	  $(".totop").css("top",dd+"px");
                  $("#knowM").show();
            });
            
            $(".huanxi").click(function(){
            	var dd = $(window).scrollTop()+110;
            	  $(".agreeTop").css("top",dd+"px");
                  $(".agree-main").show();
            });
            $("#x4").click(function(){
                  $(".agree-main").hide();
            });
            
            $("#confirmOrderSubmit").click(function(){
                  $(".agree-main").hide();
            });
            
            
            $(".next").click(function(){
            	  switch (agreePage) {
                    case (1):
                        $(".pre").removeClass('pre-no');
                        $("#agreePage1").hide();
                        $("#agreePage2").show();
                        $(".agree-title").text("中国联通4G套餐优惠活动业务协议");
                        $(".cur-agree .cur-num").text("2");
                        agreePage++;
                        break;
                    case (2):
                        $(".next").addClass('next-no');
                        $("#agreePage2").hide();
                        $("#agreePage3").show();
                        $(".agree-title").text("上海联通4G套餐办理须知");
                        $(".cur-agree .cur-num").text("3");
                        agreePage++;
                        break;
                    case (3):
                        break;
                }
            });
            
            $(".pre").click(function(){
            	  switch (agreePage) {
                    case (1):
                        break;
                    case (2):
                        $(".pre").addClass('pre-no');
                        $("#agreePage2").hide();
                        $("#agreePage1").show();
                        $(".agree-title").text("中国联通客户入网服务协议");
                        $(".cur-agree .cur-num").text("1");
                        agreePage--;
                        break;
                    case (3):
                        $(".next").removeClass('next-no');
                        $("#agreePage3").hide();
                        $("#agreePage2").show();
                        $(".agree-title").text("中国联通4G套餐优惠活动业务协议");
                        $(".cur-agree .cur-num").text("2");
                        agreePage--;
                        break;
                }
            });
            
            
            
            $(".yanzheng").click(function(){
            	
            	if($("#receiverNameCorrect").is(":visible")&&$("#idCardCorrect").is(":visible")){
            		$("#ranhoune").hide();
            		mingzi = $("#userName").val();
            		shenfenzheng = $("#identify").val();
            	    $(".inforname").text(mingzi);
            	    $(".inforIden").text(shenfenzheng);
            	    $(".customerName").text(mingzi);
            	    $(".customerId").text(shenfenzheng);
            	    
            	    var oDate = new Date(); //实例一个时间对象；
                    var year = oDate.getFullYear();   //获取系统的年；
                    var month = oDate.getMonth()+1;   //获取系统月份，由于月份是从0开始计算，所以要加1
                    var day = oDate.getDate(); // 获取系统日，
            	    $(".contractDate").text(year+'年'+month+'月'+day+'日 ');
            	    
            	    $("#useNewNumChange").text("修改");
            	    $("#userName").hide();
            	    $("#identify").hide();
            	    $("#receiverNameCorrect").hide();
            	    $("#idCardCorrect").hide();

            	}

            });
            
            
            $("#useNewNumChange").click(function(){
            	    $("#ranhoune").show();
            	    $(".inforname").text("");
            	    $(".inforIden").text("");
            	    $("#useNewNumChange").text("");
            	    $("#userName").show();
            	    $("#identify").show();
            	    $("#receiverNameCorrect").show();
            	    $("#idCardCorrect").show();
            	

            });
            

            
            
            
            $("#oneMonth").click(function(){
                  monthFee = "付全月";
                  tuijian = 1;
                  $("#no1").addClass('xinhaolei');
                  $("#no2").removeClass('xinhaolei');
                  $("#no3").removeClass('xinhaolei');
                  $(".zi").addClass('colorY');
                  $(".zi").siblings().removeClass('colorY');
                  
                  
                  
            });
            
            $("#no1").click(function(){
                  tuijian = 1;
                  $("#no1").addClass('xinhaolei');
                  $("#no2").removeClass('xinhaolei');
                  $("#no3").removeClass('xinhaolei');
                  $(".zi").addClass('colorY');
                  $(".zi").siblings().removeClass('colorY');
                  
                  
            });
            
            $("#no2").click(function(){
                  tuijian = 2;
                  $("#no2").addClass('xinhaolei');
                  $("#no1").removeClass('xinhaolei');
                  $("#no3").removeClass('xinhaolei');
                  $(".zi1").addClass('colorY');
                  $(".zi1").siblings().removeClass('colorY');
                  
                  
            });
            
            
            $("#no3").click(function(){
                  tuijian = 3;
                  $("#no3").addClass('xinhaolei');
                  $("#no1").removeClass('xinhaolei');
                  $("#no2").removeClass('xinhaolei');
                  $(".zi2").addClass('colorY');
                  $(".zi2").siblings().removeClass('colorY');
                  
                  
            });
            
            
            $("#banMonth").click(function(){
                  monthFee = "付半月";
                  tuijian = 2;
                  $("#no2").addClass('xinhaolei');
                  $("#no1").removeClass('xinhaolei');
                  $("#no3").removeClass('xinhaolei');
                  $(".zi1").addClass('colorY');
                  $(".zi1").siblings().removeClass('colorY');
                  
            });
            $("#water").click(function(){
                  monthFee = "按量计费";
                  tuijian = 3;
                  $("#no3").addClass('xinhaolei');
                  $("#no1").removeClass('xinhaolei');
                  $("#no2").removeClass('xinhaolei');
                  $(".zi2").addClass('colorY');
                  $(".zi2").siblings().removeClass('colorY');
                  
                  
            });
            
            
            $(".laoyang").click(function(){
            	  
            	switch (tuijian) {
                    case (1):
                        monthFee = "付全月";
                        $("#oneMonth").addClass('select');
                        $("#banMonth").removeClass('select');
                        $("#water").removeClass('select');
                        
                        
                        break;
                    case (2):
                        monthFee = "付半月";
                        $("#banMonth").addClass('select');
                        $("#oneMonth").removeClass('select');
                        $("#water").removeClass('select');
                        break;
                    case (3):
                        monthFee = "按量计费";
                        $("#water").addClass('select');
                        $("#oneMonth").removeClass('select');
                        $("#banMonth").removeClass('select');
                        break;
                }
            	
            	  
                  $("#firstMonth").hide();
            });
            
            
            $(".agreeTop").hover(function(){
              $(".change-agree").stop().fadeIn();
            },function(){
              $(".change-agree").stop().fadeOut();
            });
            
            
            $(".closeRead").click(function(){
                  $("#knowM").hide();
            });
            
            
            $(".close").click(function(){
               
               if($(".numberPicked").text()!==""){
               	  backUp=1;
               }else{
               	  backUp=0;
               }
               
            	  
//             $(".numberList .li").removeClass('sselect');
//             $(".numberList .li").children(".add-choice").text("加入备选");
               $("#roleSel").val(""); 
               $("#preFeeSel").val("0"); 
               $("#keySearch").val("2-4位数字");
               $("#keySearch").css("color","#999");
               

		       for(var i=0;i<3;i++){
            	    if($(".numberPicked").text()!==myOption[i].phoneNumber){
            		
            	  	       myOption[i].phoneNumber = "";
                           myOption[i].preFee = "";
                           myOption[i].preFeeUse = "";
                           myOption[i].J_numMemo = "";
                        
            	    }
               
               }
               
               organizeMyArray();
                             //调整数组只是移动一次位置
               if(myOption[1].phoneNumber!==""){
               	    organizeMyArray();
               }
                             
		              	     
		              	     
		              	     
		              	     
		              	     
		              	     
		              	     if(myOption[0].phoneNumber !== ""){
		              	     	
		              	     	chosenOptionCanceled.phoneNumber = myOption[0].phoneNumber;
                                chosenOptionCanceled.preFee = myOption[0].preFee;
                                chosenOptionCanceled.preFeeUse = myOption[0].preFeeUse;
                                chosenOptionCanceled.J_numMemo = myOption[0].J_numMemo;
		              	     	
		              	     }else{
		              	     	
		              	     	myOption[0].phoneNumber = chosenOptionCanceled.phoneNumber;
                                myOption[0].preFee = chosenOptionCanceled.preFee;
                                myOption[0].preFeeUse = chosenOptionCanceled.preFeeUse;
                                myOption[0].J_numMemo = chosenOptionCanceled.J_numMemo;
		              	     	
		              	     }
               
			        
			                 arrayOutPut();
			        
			        
			                 showTextshow();
			        
			        
			                 selectHighlight();
			       

			                 selectedShowCustomer($(".choice-list .chosen").eq(backUp-1));
		              	     
                  $("#numberPick").hide();
            });
            
            
            function yuantu(){
            	  	var aa = new Array(3);
            	  
            	  for (var i=0;i<aa.length;i++){
                  
                  aa[i] = $(".MKDp p").eq(i).height();
                  
                  }
            	  var maxHeight = aa[0];
            	  

                  for(var i=1;i<aa.length;i++){ 

                    if(maxHeight<aa[i]){
                  	   maxHeight=aa[i];
                    }
                  }
            	  
            	  for (var i=0;i<aa.length;i++)
                  {
                    $(".MKDp p").eq(i).css("height",maxHeight+"px");
                    $(".MKDp").css("height",maxHeight+12+"px");
                    $(".phoneModelKindDetail").animate({height: maxHeight+12+"px"},0);
                  }
            }
            
            
            
            
//手机卡类型选择     开始
            $("#SIM").click(function(){
            	  
            	  $("#phoneLabel").show();
            	  
            	  
            	  iteration($(".phoneModelKind li").eq(0));
            	  
            	
            	  var dd = $(window).scrollTop()+110;
            	  $(".totop").css("top",dd+"px");
            	  
            	  yuantu();
                  
            });


            function iteration(ooo){
            	
            	$(".phoneModelKind li").removeClass('redSelectAction');
                ooo.addClass('redSelectAction');
            	
            	var brandCode = ooo.attr("code");
                  
                  $.each(orderInputModel_new.MODEL_MAP, function(key,val) {
				    if(brandCode==key){
				      if (val.nomal_model!=="") {
                        	$("#normalCardType").text(val.nomal_model);
                        	$("#normalCardType").show();
                        } else{
                        	$("#normalCardType").text("");
                        	$("#normalCardType").hide();
                        }
                      if (val.micro_model!=="") {
                        	$("#microCardType").text(val.micro_model);
                        	$("#microCardType").show();
                        } else{
                        	$("#microCardType").text("");
                        	$("#microCardType").hide();
                        }
                      if (val.nano_model!=="") {
                        	$("#nanoCardType").text(val.nano_model);
                        	$("#nanoCardType").show();
                        } else{
                        	$("#nanoCardType").text("");
                        	$("#nanoCardType").hide();
                        }
				    }
			      });
			      
			      for (var i=0;i<3;i++)
                  {
                    if ($(".MKDp p").eq(i).is(":visible")) {
                    	$(".simKind2 li").eq(i).show();
                    } else{
                    	$(".simKind2 li").eq(i).hide();
                    }
                    
                  };
			      
			      for (var i=0;i<3;i++)
                  {
                    $(".MKDp p").css('height','auto');
                    
                  };
            	  
            	  for (var i=0;i<3;i++)
                  {
                    if ($(".MKDp p").eq(i).is(":visible")) {
                    	$(".MKDp p").removeClass('redSelectAction');
                        $(".MKDp p").eq(i).addClass('redSelectAction');
                    	$(".simKind2 li").removeClass('redSelectAction');
                        $(".simKind2 li").eq(i).addClass('redSelectAction');
                        inS=i;
                        break;
                    } 
                    
                  };
            	  
            	
            }


            $(".phoneModelKind li").click(function(){
                  
                  iteration($(this));
			      
			      yuantu();
                  
                  
            });
            
            
            $(".alibb").click(function(){
            	  
            	  $(".taipeii").removeClass('selectt');
                  $(".taipeii").eq(inS).addClass('selectt');
            	
            	switch (inS) {
                    case (0):
                        cardType = "普卡";
                        break;
                    case (1):
                        cardType = "微卡";
                        break;
                    case (2):
                        cardType = "Nano卡";
                        break;
              }; 
                  
                  
              $("#phoneLabel").hide();    
              alert(cardType);    
            });
            $("#c4").click(function(){
            	  
            	  
            	  
            	  
                  $("#phoneLabel").hide();
                  
              alert(cardType);    
                  
            });
            $(".taipeii").click(function(){
                  $(this).addClass('selectt');
                  $(".taipeii").not(this).removeClass('selectt');
                  inS = $(".taipeii").index($(this));
                  
                  switch (inS) {
                    case (0):
                        cardType = "普卡";
                        break;
                    case (1):
                        cardType = "微卡";
                        break;
                    case (2):
                        cardType = "Nano卡";
                        break;
                 };
                 alert(cardType);
            });
            $(".MKDp p").click(function(){
            	  $(this).addClass('redSelectAction');
                  $(".MKDp p").not(this).removeClass('redSelectAction');
                  
            	  inS = $(".MKDp p").index($(this));
            	
                  $(".simKind2 li").removeClass('redSelectAction');
                  $(".simKind2 li").eq(inS).addClass('redSelectAction');
                  
                  
            });
            
            $(".simKind2 li").click(function(){
            	  $(this).addClass('redSelectAction');
                  $(".simKind2 li").not(this).removeClass('redSelectAction');
            	 
            	  inS = $(".simKind2 li").index($(this));
            	
                  $(".MKDp p").removeClass('redSelectAction');
                  $(".MKDp p").eq(inS).addClass('redSelectAction');
                  
            	
            });
            
//手机卡类型选择     结束           
            
            
            
            $(".prePage").click(function(){
                  $("#page1").show();
                  $("#page2").hide();
            });
            
            $(".nextPage").click(function(){
                  $("#page2").show();
                  $("#page1").hide();
            });
            
            
            
//jquery ajax 获取远程json的号码 写入html            
            $(".xiaodong2").click(function(){
            	  $(".showNumber").children(".numberList").remove();
            	  $("#roleSel").val(""); 
                  $("#preFeeSel").val("0"); 
                  $("#keySearch").val("2-4位数字");
                  $("#keySearch").css("color","#999");
                  $("#numberPick").show();
                  var numberSearch = {
                              goodNumberType:$("#roleSel").val(),
                              numberPriceInterval:$("#preFeeSel").val(),
                              numberKeySearch:$("#keySearch").val()
                  };
                  
                  $.ajax({
		              type: "get",
		              url: "phoneNumber.json",
		              async: true,
		              data: numberSearch,
		              success: function(lwf){
		              	     ajaxGetNumberJason(lwf);
		              }
		              
	              });
                  
            });
            
            
//搜索靓号功能


            function choiceGoodNumber(){
            	
            	var d = /^\d{2}$|^\d{3}$|^\d{4}$/;
				var t = $("#keySearch").val();
				
				var numberSearch = {
                            goodNumberType:$("#roleSel").val(),
                            numberPriceInterval:$("#preFeeSel").val(),
                            numberKeySearch:$("#keySearch").val()
                };
				
				if(t!=="2-4位数字"){
					
				  if(d.test(t)){
					$.ajax({
		              type: "get",
		              url: "phoneNumber.json",
		              async: true,
		              data: numberSearch,
		              success: function(lwf){
		              	     ajaxGetNumberJason(lwf);
		              }
		              
	                });
	              
				  }else{
					alert("请输入2-4位的数字");
					
				  }
					
				}else{
					
					$.ajax({
		              type: "get",
		              url: "phoneNumber.json",
		              async: true,
		              data: numberSearch,
		              success: function(lwf){
		              	     ajaxGetNumberJason(lwf);
		              }
		              
	                });
					
				}
            	
            }
            
            $("#keySearch").blur(function(){
            	if($("#keySearch").val()==""){
            		$("#keySearch").val("2-4位数字");
            		$(this).css("color","#999");
            		
            	}
            	choiceGoodNumber();
            	
            });
            
            $("#preFeeSel").change(function(){
            	
            	choiceGoodNumber();
            	
            });
            
            
            $("#roleSel").change(function(){
            	
            	choiceGoodNumber();
            	
            });
            
            $("#numberSearchBtn").click(function(){
            	
            	choiceGoodNumber()
            	
            });
            
            
//搜索靓号功能           
            
            
            $("#buyao").click(function(){
                  $(".shoshow").hide();
            });
            
            
            
            $("#buyao1").click(function(){
                  $(".shoshow").hide();
            });
            
            
            
            $("#ccc").click(function(){
                  $("#sAddress").hide();
            });
            
            $(".pickAddress").click(function(){
            	var dd = $(window).scrollTop()+110;
            	  $(".totop").css("top",dd+"px");
                  $("#sAddress").show();
            });
            
			
			$( "#nation" ).hover(
               function() {
               $(".liweifeng1").show();
               }, function() {
               $(".liweifeng1").hide();
               }
            );
			$( "#local" ).hover(
               function() {
               $(".liweifeng2").show();
               }, function() {
               $(".liweifeng2").hide();
               }
            );
			
			
//选择地区的设置
            
            $('.addressInput').change(function(){ 
               var sendText = $(this).children('option:selected').text(); 
               
               $(this).siblings().find("label.seLectStLabel1").text(sendText);
//             $(this).parent().children(".seLectStSpan1").children(".seLectStLabel1").text(sendText)


//验证是否为空
               if($("#provinceId").children('option:selected').text()!=="省份/直辖市"){

                 $("#detailcityCorrect1").show();
               	 $("#detailcityError1").hide();
               };
               if($("#provinceId").children('option:selected').text()=="省份/直辖市"){
               	
               	 $("#detailcityCorrect1").hide();
               	 $("#detailcityError1").show();
               	 $("#detailcityError1").text("请选择省份");
               };
            
            });
            
            $("#provinceId").change(function(){
            	var sendText1 = $("#cityId").children('option:selected').text(); 
               
                $("#cityId").siblings().find("label.seLectStLabel1").text(sendText1);
                
                var sendText2 = $("#areaId").children('option:selected').text(); 
               
                $("#areaId").siblings().find("label.seLectStLabel1").text(sendText2);
            });
            
            $("#cityId").change(function(){
            	var sendText1 = $("#cityId").children('option:selected').text(); 
               
                $("#cityId").siblings().find("label.seLectStLabel1").text(sendText1);
                
                var sendText2 = $("#areaId").children('option:selected').text(); 
               
                $("#areaId").siblings().find("label.seLectStLabel1").text(sendText2);
            });
            

            $("#consigneeAddress").blur(function(){
            	
            	
               if($("#consigneeAddress").val()==""){
               	
               	 $("#detailcityCorrect2").hide();
               	 $("#detailcityError2").show();
               	 $("#detailcityError2").text("请填写详细地址");
               }else{
               	 $("#detailcityCorrect2").show();
               	 $("#detailcityError2").hide();
               };
            });
            
            
            $("#consigneePhone").blur(function(){
            	
            	
               if($("#consigneeAddress").val()==""){
               	
               	 $("#detailcityCorrect3").hide();
               	 $("#detailcityError3").show();
               	 $("#detailcityError3").text("手机号码不能为空");
               }else{
               	 $("#detailcityCorrect3").show();
               	 $("#detailcityError3").hide();
               };
            	
            });


            $(".chuanyue").click(function(){
            	
            	var gbName = $("#consignee").val();
            	var province = $("#provinceId").children('option:selected').text();
            	var city = $("#cityId").children('option:selected').text();
            	var areaIn = $("#areaId").children('option:selected').text();
            	var addressDetail = $("#consigneeAddress").val();
            	var phoneNumber = $("#consigneePhone").val();
            	
            	$(".consignee").text(gbName);
            	$(".consigneePhone").text(phoneNumber);
            	$(".province").text(province);
            	$(".city").text(city);
            	$(".county").text(areaIn);
            	$(".address").text(addressDetail);
            	
            	var pan = $("#consigneeCorrect").is(":visible")&&$("#detailcityCorrect1").is(":visible")&&$("#detailcityCorrect2").is(":visible")&&$("#detailcityCorrect3").is(":visible");
                var pen = $("#consigneeAddress").val()!==""&&$("#consigneePhone").val()!==""&&$("#consignee").val()!=="";
                
               if(pan&&pen){
               	 $("#sAddress").hide();
               	 $(".addressNew").hide();
               	 $(".userInfoDetail").show();
               }
               
            });
            
            $(".addressDel").click(function(){
            	 
            	 var dd = $(window).scrollTop()+110;
            	  $(".totop").css("top",dd+"px");
                  $("#confirmDel").show();
            	 
               	 $("#confirmDel").show();
            });
            $("#qiz").click(function(){
            	$("#confirmDel").hide();
            });

            $(".shif").click(function(){
            	$("#confirmDel").hide();
            	$(".userInfoDetail").hide();
               	 $(".addressNew").show();
               	 $(".consignee").text("");
            	$(".consigneePhone").text("");
            	$(".province").text("");
            	$(".city").text("");
            	$(".county").text("");
            	$(".address").text("");
            });


            $(".addressEdit").click(function(){
            	 
               	 $("#sAddress").show();
            });

            $(".userInfoDetail").hover(function(){
              $(".yuanzong").stop().show();
            },function(){
              $(".yuanzong").stop().hide();
            });



//选择地区的设置    结束    
			
//首页价格计算和传递			
			
			$("#nationTimeNo").click(function(){
				
				
				$("#nation6").show();
				$("#nation6").addClass('selected2');
				$("#nationNo").show();
			});
			
			$("#localTimeNo").click(function(){
				$("#localRemove").removeClass('selected2');
				$("#localRemove").hide();
				
				$("#local6").show();
				$("#local6").addClass('selected2');
				$("#localNo").show();
			});
			
			
			$(".xiaodongdd").click(function(){
				$(".xiaodongdd").removeClass('selected2');
				$(this).addClass('selected2');
			});
			
			
			$(".xiaodongb").not("#nationTimeNo").click(function(){
				
				$("#nation6").show();
				$(".xiaodongd").removeClass('selected2');
				$("#nation6").addClass('selected2');
				
				$("#nationNo").hide();
			});
			
			$(".xiaodongbb").not("#localTimeNo").click(function(){
				
				$("#localRemove").show();
				$(".xiaodongdd").removeClass('selected2');
				$("#localRemove").addClass('selected2');
				
				$("#local6").hide();
				$("#localNo").hide();
			});
			
			
			
			function countNation(){
				  
				  flowPriceNation = $(".xiaodonga.selected2").attr("price");
                  timePriceNation = $(".xiaodongb.selected2").attr("price");
                  smsPriceNation = $(".xiaodongc.selected2").attr("price");
                  showPriceNation = $(".xiaodongd.selected2").attr("price");
                  priceNation = parseInt(flowPriceNation,10)+parseInt(timePriceNation,10)+parseInt(smsPriceNation,10)+parseInt(showPriceNation,10);
                  
                  
                  flowNation = $(".xiaodonga.selected2").attr("flow");
                  $("#nationFlow").text(flowNation);
				  
				  timeNation = $(".xiaodongb.selected2").attr("time");
				  if (timeNation!=="无") {
				  	$("#wutonghua").text("，通话");
				  	$("#nationTime").text(timeNation);
				  } else{
				  	$("#wutonghua").text("");
				  	$("#nationTime").text("");
				  }
				  
				  smsNation = $(".xiaodongc.selected2").attr("sms");
				  if (smsNation!=="无") {
				  	$("#wuxinxi").text("，短/彩信");
				  	$("#nationSms").text(smsNation);
				  } else{
				  	$("#wuxinxi").text("");
				  	$("#nationSms").text("");
				  }
				  
				  
				  showNation = $(".xiaodongd.selected2").attr("show");
				  if (showNation!=="无") {
				  	$("#wuxianshi").text("，来显包");
				  	$("#nationShow").text(showNation);
				  } else{
				  	$("#wuxianshi").text("");
				  	$("#nationShow").text("");
				  }
			
			      if (priceNation<=50) {
			      	moneyNation = 50;
			      	$("#nationMoney").text(moneyNation+"元");
			      } else{
			      	moneyNation = Math.ceil(priceNation/100)*100;
			      	$("#nationMoney").text(moneyNation+"元");
			      }
			      $("#nationPrice").text(priceNation+"元");
			
			}
			
			
			
			
			
			$(".xiaodonga").click(function(){
				  $(".xiaodonga").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  
                  countNation();
            });
			
			$(".xiaodongb").click(function(){
				  $(".xiaodongb").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  countNation();
                 
            });
            
            $(".xiaodongc").click(function(){
            	  $(".xiaodongc").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  countNation();
                  
            });
            
            $(".xiaodongd").click(function(){
				$(".xiaodongd").removeClass('selected2');
				$(this).addClass('selected2');
				
				countNation();
				
			});
			
			
			function showMeMoneyNation(){
				
				$(".xiangxia").text(priceNation+"元/月");
                  
                  $("#pPart1").text("("+flowPriceNation+"元包"+flowNation);
                  
                  if (timeNation!=="无") {
				  	$("#pPart2").text("，"+timePriceNation+"元包"+timeNation);
				  	
				  } else{
				  	$("#pPart2").text("");
				  	
				  }
                  
                  if (smsNation!=="无") {
				  	$("#pPart3").text("，"+smsPriceNation+"元包"+smsNation);
				  	
				  } else{
				  	$("#pPart3").text("");
				  
				  }
                  
                  if (showNation!=="无") {
                  	if(showNation!=="来电显示免费"){
                  		
                  	   $("#pPart4").text("，"+showPriceNation+"元/月 "+showNation);
                  	}else{
                  	   $("#pPart4").text("，"+showNation);
                  	}
				  	
				  } else{
				  	
				  	$("#pPart4").text("");
				  }
				  $(".goodsPrice").text((moneyNation*0.4).toFixed(2));
				  $(".lineThrough").text("¥"+moneyNation.toFixed(2));
				  $(".goodsPriceDesc").text("(含"+moneyNation.toFixed(2)+"元话费，立即到账)");
			}
			
			
			
			$("#yao").click(function(){
				  
				  countNation();
				
                  $(".shoshow").hide();
                  $(".xiaodong1").hide();
                  $(".xiangxia").show();
                  $(".bude").show();
                  $("#zouba").show();
                  
                  yao = true;
                  showMeMoneyNation();
                  
                  
            });
            
            
            function countLocal(){
				  
				  flowPriceLocal = $(".xiaodongaa.selected2").attr("price");
                  timePriceLocal = $(".xiaodongbb.selected2").attr("price");
                  smsPriceLocal = $(".xiaodongcc.selected2").attr("price");
                  showPriceLocal = $(".xiaodongdd.selected2").attr("price");
                  priceLocal = parseInt(flowPriceLocal,10)+parseInt(timePriceLocal,10)+parseInt(smsPriceLocal,10)+parseInt(showPriceLocal,10);
                  
                  
                  flowLocal = $(".xiaodongaa.selected2").attr("flow");
                  $("#localFlow").text(flowLocal);
				  
				  timeLocal = $(".xiaodongbb.selected2").attr("time");
				  if (timeLocal!=="无") {
				  	$("#wutonghuaLocal").text("，通话");
				  	$("#localTime").text(timeLocal);
				  } else{
				  	$("#wutonghuaLocal").text("");
				  	$("#localTime").text("");
				  }
				  
				  smsLocal = $(".xiaodongcc.selected2").attr("sms");
				  if (smsLocal!=="无") {
				  	$("#wuxinxiLocal").text("，短/彩信");
				  	$("#localSms").text(smsLocal);
				  } else{
				  	$("#wuxinxiLocal").text("");
				  	$("#localSms").text("");
				  }
				  
				  
				  showLocal = $(".xiaodongdd.selected2").attr("show");
				  if (showLocal!=="无") {
				  	$("#wuxianshiLocal").text("，来显包");
				  	$("#localShow").text(showLocal);
				  } else{
				  	$("#wuxianshiLocal").text("");
				  	$("#localShow").text("");
				  }
			
			      if (priceLocal<=50) {
			      	moneyLocal = 50;
			      	$("#localMoney").text(moneyLocal+"元");
			      } else{
			      	moneyLocal = Math.ceil(priceLocal/100)*100;
			      	$("#localMoney").text(moneyLocal+"元");
			      }
			      $("#localPrice").text(priceLocal+"元");
			
			}
			
			
			$(".xiaodongaa").click(function(){
				  $(".xiaodongaa").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  
                  countLocal();
            });
			
			$(".xiaodongbb").click(function(){
				  $(".xiaodongbb").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  countLocal();
                 
            });
            
            $(".xiaodongcc").click(function(){
            	  $(".xiaodongcc").removeClass('selected2');
                  $(this).addClass('selected2');
                  
                  countLocal();
                  
            });
            
            $(".xiaodongdd").click(function(){
				$(".xiaodongdd").removeClass('selected2');
				$(this).addClass('selected2');
				
				countLocal();
				
			});
			

            
            function showMeMoneyLocal(){
				
				$(".xiangxiaLocal").text(priceLocal+"元/月");
                  
                  $("#pPart1Local").text("("+flowPriceLocal+"元包"+flowLocal);
                  
                  if (timeLocal!=="无") {
				  	$("#pPart2Local").text("，"+timePriceLocal+"元包"+timeLocal);
				  	
				  } else{
				  	$("#pPart2Local").text("");
				  	
				  }
                  
                  if (smsLocal!=="无") {
				  	$("#pPart3Local").text("，"+smsPriceLocal+"元包"+smsLocal);
				  	
				  } else{
				  	$("#pPart3Local").text("");
				  
				  }
                  
                  if (showLocal!=="无") {
                  	if(showLocal!=="来电显示免费"){
                  		
                  	   $("#pPart4Local").text("，"+showPriceLocal+"元/月 "+showLocal);
                  	}else{
                  	   $("#pPart4Local").text("，"+showLocal);
                  	}
				  	
				  } else{
				  	
				  	$("#pPart4Local").text("");
				  }
				  $(".goodsPrice").text((moneyLocal*0.4).toFixed(2));
				  $(".lineThrough").text("¥"+moneyLocal.toFixed(2));
				  $(".goodsPriceDesc").text("(含"+moneyLocal.toFixed(2)+"元话费，立即到账)");
			}
			
			
			
			
			$("#yao1").click(function(){
				  
				  countLocal();
				
                  $(".shoshow").hide();
                  $(".xiaodong1").hide();
                  $(".xiangxiaLocal").show();
                  $(".budeLocal").show();
                  $("#zouba").show();
                  
                  yao1 = true;
                  showMeMoneyLocal();//用于把确定的所有价格参数 显示到最终页面上去
                  
                  
            });
			
			$(".xiaodong").click(function(){
            	  
            	  $(".xiaodong").removeClass('selected');
                  $(this).addClass('selected');
                  
            });
			
			$("#nation").click(function(){
                  nation = 1;
                  
                  $(".xiangxiaLocal").hide();
                  $(".budeLocal").hide();
                  
                  if(yao==true){
                  	$(".xiaodong1").hide();
                    $(".xiangxia").show();
                    $(".bude").show();
                    $("#zouba").show();
                    var changePrice = parseInt($(".xiangxia").text());
                    var changeMoney;
                    if (changePrice<=50) {
			      	changeMoney = 50;
			      	
			        } else{
			      	changeMoney = Math.ceil(changePrice/100)*100;
			      	
			        }
			      
                    
                    $(".goodsPrice").text((changeMoney*0.4).toFixed(2));
				    $(".lineThrough").text("¥"+changeMoney.toFixed(2));
				    $(".goodsPriceDesc").text("(含"+changeMoney.toFixed(2)+"元话费，立即到账)");
                    
                    
                  }else{
                  	$(".xiaodong1").show();
                  	$(".xiangxia").hide();
                    $(".bude").hide();
                    $("#zouba").hide();
                    
                    var p=50;
                    $(".goodsPrice").text((p*0.4).toFixed(2));
				    $(".lineThrough").text("¥"+p.toFixed(2));
				    $(".goodsPriceDesc").text("(含"+p.toFixed(2)+"元话费，立即到账)");
                  }
                  
                  
            });
            
            $("#local").click(function(){
                  nation = 0;
                  
                  $(".xiangxia").hide();
                  $(".bude").hide();
                  
                  if(yao1==true){
                  	$(".xiaodong1").hide();
                    $(".xiangxiaLocal").show();
                    $(".budeLocal").show();
                    $("#zouba").show();
                    var changePrice = parseInt($(".xiangxiaLocal").text());
                    var changeMoney;
                    if (changePrice<=50) {
			      	changeMoney = 50;
			      	
			        } else{
			      	changeMoney = Math.ceil(changePrice/100)*100;
			      	
			        }
			      
                    
                    $(".goodsPrice").text((changeMoney*0.4).toFixed(2));
				    $(".lineThrough").text("¥"+changeMoney.toFixed(2));
				    $(".goodsPriceDesc").text("(含"+changeMoney.toFixed(2)+"元话费，立即到账)");
                    
                    
                    
                  }else{
                  	$(".xiaodong1").show();
                  	$(".xiangxiaLocal").hide();
                    $(".budeLocal").hide();
                    $("#zouba").hide();
                    
                    var p=50;
                    $(".goodsPrice").text((p*0.4).toFixed(2));
				    $(".lineThrough").text("¥"+p.toFixed(2));
				    $(".goodsPriceDesc").text("(含"+p.toFixed(2)+"元话费，立即到账)");
                  }
                  
            });
            
            
            
            $(".xiaodong1").click(function(){
                  if (nation==1) {
                  	$("#nationGroup").show();
                  	countNation();//用于在用户点击选择时进行价格规格的计算
                  
                  } else if(nation==0){
                  	$("#localGroup").show();
                  	countLocal();
                 	
                  };
            });
			
			$("#zouba").click(function(){
                  if (nation==1) {
                  	$("#nationGroup").show();
                  	countNation();
                  	
                  } else if(nation==0){
                  	$("#localGroup").show();
                  	countLocal();
                  	
                  };
            });
            
			
			
//首页价格计算和传递      结束			
			
			$(window).scroll(function(){
				var dd = $(window).scrollTop();
				
				if(dd>50){
				   $("#goTop").fadeIn(250);
				}else{
				   $("#goTop").fadeOut(250);
				}
			});
			
			$(".goTop").click(function(){
				$("html,body").animate({scrollTop: '0px'}, 100);
			});
			
			
			
			$(".showNumber").on("mouseover",".numberList li",function(){
               $(this).addClass('hover');
               var d = $(this).children(".pNumber").text();
               var p1 = d.substr(0,3);
               var p2 = d.substr(6,4);
               var p3 = d.substr(11,4);
               if($(this).children(".pNumber").children(".orangeTail").length==0){
               	  
               	  $(this).children(".pNumber").text(p1+" "+p2+" "+p3);
               	  
               }else{
               	  var s = $(this).children(".pNumber").children(".orangeTail").text();
               	  var m = s.length;
                  var n = 4 - m;
                  var p4 = p3.substr(0,n);
               	  
               	  $(this).children(".pNumber").html(p1+" "+p2+" "+p4+"<span class=\"orangeTail\">"+s+"<\/span>");
               }
               
               
			});
               
            $(".showNumber").on("mouseout",".numberList li",function(){
               
               $(this).removeClass('hover');
               var s = $(this).children(".pNumber").text();
               var c1 = s.substr(0,3);
               var c2 = s.substr(4,4);
               var c3 = s.substr(9,4);
               
               if($(this).children(".pNumber").children(".orangeTail").length==0){
               	  
               	  $(this).children(".pNumber").html(c1+"&nbsp;&nbsp;&nbsp;"+c2+" "+c3);
               	  
               }else{
               	  var f = $(this).children(".pNumber").children(".orangeTail").text();
               	  var m = f.length;
                  var n = 4 - m;
                  var p4 = c3.substr(0,n);
               	  
               	  $(this).children(".pNumber").html(c1+"&nbsp;&nbsp;&nbsp;"+c2+" "+p4+"<span class=\"orangeTail\">"+f+"<\/span>");
               	  
               }
               
               
            });
            
            $(".showNumber").on("mouseover",".numberList li .add-choice",function(){
		       $(this).addClass('add-choiceNew');
               
               }
            );
            
            $(".showNumber").on("mouseout",".numberList li .add-choice",function(){
               
               $(this).removeClass('add-choiceNew');
               
               }
	        );
            
            
            
//点击备选的参数操作		
           
            function organizeMyArray(){
            	
            	for (var i=0;i<3;i++){
			        	if(myOption[i].phoneNumber == ""&&i+1<3){
			        		
			        		
                            myOption[i].phoneNumber = myOption[i+1].phoneNumber;
                            myOption[i].preFee = myOption[i+1].preFee;
                            myOption[i].preFeeUse = myOption[i+1].preFeeUse;
                            myOption[i].J_numMemo = myOption[i+1].J_numMemo;
                            myOption[i+1].phoneNumber = "";
                            myOption[i+1].preFee = "";
                            myOption[i+1].preFeeUse = "";
                            myOption[i+1].J_numMemo = "";
                            
			            }
			        	
                    }
            	
            }


            function pushMyArray(obb){
            	
            	for (var i=0;i<3;i++){
			        	if(myOption[i].phoneNumber == ""){
			        		var s = obb.siblings(".pNumber").text();
                            var c1 = s.substr(0,3);
                            var c2 = s.substr(4,4);
                            var c3 = s.substr(9,4);
                            var c = c1+c2+c3;
                            
                            myOption[i].phoneNumber = c;
                            myOption[i].preFee = obb.siblings(".numberPrice").children("span").eq(0).text();
                            myOption[i].preFeeUse = obb.siblings(".numberPrice").children("span").eq(1).text();
                            myOption[i].J_numMemo = obb.siblings(".J_numMemo").attr("value");
                            break;
			            }
			        	
                }
            	
            }


            function arrayOutPut(){
            	
            	for (var i=0;i<3;i++){
			        	    
			        	    var s = myOption[i].phoneNumber;
                            var c1 = s.substr(0,3);
                            var c2 = s.substr(3,4);
                            var c3 = s.substr(7,4);
                            
                            $(".choice-list .chosen").eq(i).children(".pNumber").html(c1+" "+c2+" "+c3);
			        	    
			        	    $(".choice-list .chosen").eq(i).children(".numberPrice").children("span").eq(0).text(myOption[i].preFee);
			        	    $(".choice-list .chosen").eq(i).children(".numberPrice").children("span").eq(1).text(myOption[i].preFeeUse);
			        	
			        	    $(".choice-list .chosen").eq(i).children(".J_numMemo").attr("value",myOption[i].J_numMemo);
			        	
			        	
                }
            	
            }
            
            function showTextshow(){
            	
            	for (var i=0;i<3;i++){
            	
            	    if(myOption[i].phoneNumber !== ""){
			        		
			        	$(".choice-list .chosen").eq(i).children(".showText").hide();
			        		
			        }else{
			        	
			        	$(".choice-list .chosen").eq(i).children(".showText").show();
			        	
			        }
            	
            	}
            	
            }
            
            
         

            function selectHighlight(){
            	
			    $(".choice-list .chosen").removeClass('hoover');
			    if(backUp>0){
			        $(".choice-list .chosen").eq(backUp-1).addClass('hoover');
			    }
            	
            }
            


            function selectedShowCustomer(obj){
            	
            	if(backUp>0){
            		$(".kuang1").show();
            		$(".soldNumber").text(obj.children(".pNumber").text());
			        $(".soldPrice").text(obj.children(".numberPrice").children("span").eq(0).text());
			        if(obj.children(".J_numMemo").attr("value")!==""){
			            $(".soldMemo").text("("+obj.children(".J_numMemo").attr("value")+")");
			        }else{
			    	$(".soldMemo").text("");
			        }
            	}else{
            		$(".soldNumber").text("");
			        $(".soldPrice").text("");
            		$(".soldMemo").text("");
            		$(".kuang1").hide();
            	}
            	
            	
            }


            function removeMyArray(obb){
            	
            	var s = obb.siblings(".pNumber").text();
                var c1 = s.substr(0,3);
                var c2 = s.substr(4,4);
                var c3 = s.substr(9,4);
                var c = c1+c2+c3;
			        
			    for (var i=0;i<3;i++){
			        	
			        if(myOption[i].phoneNumber == c){
                            
                        myOption[i].phoneNumber = "";
                        myOption[i].preFee = "";
                        myOption[i].preFeeUse = "";
                        myOption[i].J_numMemo = "";
                        break;
			        }
			        	
                }
            	
            }



			$(".showNumber").on("click",".numberList li .add-choice",function(){
				
				if($(this).text()=="加入备选"&&backUp<3){
					$(this).parents('.li').addClass('full').addClass('sselect');
			        $(this).text("取消备选");
			        backUp++;
			        
			        organizeMyArray();
			        
			        
			        pushMyArray($(this));
			        
			        
			        arrayOutPut();
			        
			        
			        showTextshow();
			        
			        
			        selectHighlight();
			       

			        selectedShowCustomer($(".choice-list .chosen").eq(backUp-1));
			        
			        
				}else if($(this).text()=="取消备选"){
					$(this).parents('.li').removeClass('full').removeClass('sselect');
			        $(this).text("加入备选");
			        backUp--;
			        
			        
			        removeMyArray($(this));
			        
			       
			        organizeMyArray();
			        
			        
			        arrayOutPut();
			        
			        
			        showTextshow();
			       
			       
			        selectHighlight();
			        
			    	
			        selectedShowCustomer($(".choice-list .chosen").eq(backUp-1));
			        
			        
				}
				
			  }
			);


//用户点击备选号码显示详情
			$(".choice-list .chosen").click(function(){
				
				if(!$(this).children(".showText").is(":visible")){
					$(".choice-list .chosen").removeClass('hoover');
				    $(this).addClass('hoover');
				    
				    selectedShowCustomer($(this));
				    
				}
				
				
			});
			
			
			$(".choice-list .chosen .shut").click(function(){
				
				var s = $(this).siblings(".pNumber").text();
                
                for(var i=0;i<3;i++){
                	
                    var d = $(".numberList .li.sselect").eq(i).children(".pNumber").text();
                    var p1 = d.substr(0,3);
                    var p2 = d.substr(6,4);
                    var p3 = d.substr(11,4);
                    var cc = p1+" "+p2+" "+p3;
                    
                    if(cc==s){
                    	
                    	$(".numberList .li.sselect").eq(i).children(".add-choice").text("加入备选");
                    	$(".numberList .li.sselect").eq(i).removeClass('sselect');
			            
			            backUp--;
			        
			        
			            removeMyArray($(this));
			        
			       
			            organizeMyArray();
			        
			        
			            arrayOutPut();
			        
			        
			            showTextshow();
			       
			       
			            selectHighlight();
			        
			    	
			            selectedShowCustomer($(".choice-list .chosen").eq(backUp-1));
                    	
                    	
                    	if($(this).siblings(".showText").is(":visible")){
                    		$(this).hide();
                    	}
                    	
                    	
                    	
                    	
                    	break;
                    }
                    
                }
				
				
				
				
			});
			
			
			
		    $(".querenNumber").click(function(){
		    	
		    	
		    	if($(".kuang1").is(":visible")){
		    		if($(".numWaring").is(":visible")){
		    			clearInterval(_interval);
		    		    
		    		    $(".numWaring").hide();
		    		}
		    		
		    		
                    $(".numberPicked").show();
                    var d = $(".soldNumber").text();
                    var p1 = d.substr(0,3);
                    var p2 = d.substr(4,4);
                    var p3 = d.substr(9,4);
                    var pnum = p1+p2+p3;
                    $(".numberPicked").text(pnum);
                    $("#zouba1").show();
                    $(".pickedNumberMemo").show();
		    		$(".pickedNumberMemo").text($(".soldMemo").text());
		    		$(".numWaring").css("display","inline-block");
		    		$(".xiaodong2").hide();
                    $("#numberPick").hide();
                    
		    		var totalTime = 1800;
		    		var minuLeft = parseInt(totalTime/60,10);
                    var secLeft =  parseInt(totalTime-minuLeft*60,10);
		    	   	$(".numWaring span").text(minuLeft+" : "+secLeft);
		    	   	totalTime--;
		    		_interval = setInterval(function(){
		    		  if(totalTime>0){
		    		  	minuLeft = parseInt(totalTime/60,10);
                        secLeft =  parseInt(totalTime-minuLeft*60,10);
		    	   	    $(".numWaring span").text(minuLeft+" : "+secLeft);
		    	   	    totalTime--;
		    		  }else{
		    		  	$(".numWaring").text("时间到，请重新选择");
		    		  	clearInterval(_interval);
		    		  }
		    	   	  
		    	   },1000);
		    		
		    		
		    		
		    	}else{
		    		
		    	   $(".hello").show();
		    	   
		    	   setTimeout(function(){
		    	   	  $(".hello").hide();
		    	   },2000);
		    	   
		    	}
		    	
		    });
			
			
            $("#zouba1").click(function(){
            	
               backUp = 1;   
//             $(".numberList .li").removeClass('sselect');
//             $(".numberList .li").children(".add-choice").text("加入备选");
               $("#roleSel").val(""); 
               $("#preFeeSel").val("0"); 
               $("#keySearch").val("2-4位数字");
               $("#keySearch").css("color","#999");
               $("#numberPick").show();
               
                  
               $.ajax({
		              type: "get",
		              url: "phoneNumber.json",
		              async: true,
		              success: function(lwf){
		              	     ajaxGetNumberJason(lwf);
		              	     
		              	     //防止用户点击取消清空数组，再载入时候
		              	     
		              	     for(var i=0;i<3;i++){
            	                if($(".numberPicked").text()!==myOption[i].phoneNumber){
            		
            	  	                 myOption[i].phoneNumber = "";
                                     myOption[i].preFee = "";
                                     myOption[i].preFeeUse = "";
                                     myOption[i].J_numMemo = "";
                        
            	                }
               
                             }
               
                             organizeMyArray();
                             //调整数组只是移动一次位置
                             if(myOption[1].phoneNumber!==""){
               	               organizeMyArray();
                             }
                             
		              	    //处理refreshAddselect带来的bug
		              	    $(".numberList .li.sselect").removeClass('sselect');
		              	     
		              	     
		              	     
		              	     //一个以防万一加载的json含有已选号码则加标颜色
		              	     for(var j=0;j<$(".numberList .li").length;j++){
                                 var d = $(".numberList .li").eq(j).children(".pNumber").text();
                                 var p1 = d.substr(0,3);
                                 var p2 = d.substr(6,4);
                                 var p3 = d.substr(11,4);
                                 var cc = p1+p2+p3;
                   
                                 if($(".numberPicked").text()==cc){
                   	                 $(".numberList .li").eq(j).addClass('sselect');
                   	                 $(".numberList .li").eq(j).children(".add-choice").text("取消备选");
                   	             
                   	             //防止用户取消后清空了数组，再点击重选 数组为空
//                 	                 if(myOption[0].phoneNumber!==cc){
//                 	  	 
//                 	  	                 pushMyArray($(".numberList .li").eq(j).children(".add-choice"));
//                 	  	                 myOption[0].phoneNumber=cc;
//                 	  	 
//                 	                 }
                   	  
                   	  
                   	                 break;
                                 }
                             }
		              	     
		              	     if(myOption[0].phoneNumber !== ""){
		              	     	//没有被用户取消数组0项时
		              	     	chosenOptionCanceled.phoneNumber = myOption[0].phoneNumber;
                                chosenOptionCanceled.preFee = myOption[0].preFee;
                                chosenOptionCanceled.preFeeUse = myOption[0].preFeeUse;
                                chosenOptionCanceled.J_numMemo = myOption[0].J_numMemo;
		              	     	
		              	     }else{
		              	     	//被用户取消了数组0项
		              	     	myOption[0].phoneNumber = chosenOptionCanceled.phoneNumber;
                                myOption[0].preFee = chosenOptionCanceled.preFee;
                                myOption[0].preFeeUse = chosenOptionCanceled.preFeeUse;
                                myOption[0].J_numMemo = chosenOptionCanceled.J_numMemo;
		              	     	
		              	     }
               
			        
			                 arrayOutPut();
			        
			        
			                 showTextshow();
			        
			        
			                 selectHighlight();
			       

			                 selectedShowCustomer($(".choice-list .chosen").eq(backUp-1));
		              	     
		              }
		              
	           });
               
               
               
                
            });
			
			
			
			
			
			
			
//点击备选的参数操作

//鼠标悬停加颜色框 
            $(".choice-list .chosen").hover(function(){
                          if(!$(this).children(".showText").is(":visible")){
                          	$(this).addClass('hoover');
                          	$(this).children(".shut").show();
                          }
               
                       }, function(){
                          $(this).children(".shut").hide();
                          if($(".soldNumber").text()!==$(this).children(".pNumber").text()){
                          	$(this).removeClass('hoover');
                          }
               
                       }
            );

//备选已满的样式变化
            $(".showNumber").on("mouseover",".numberList li",function(){
                  if($(this).hasClass('sselect')){
                  	$(this).addClass('full');
                  }
                  
                  if(backUp==3&&!$(this).hasClass('sselect')){
                  	$(this).addClass('borderDisable');
                  	$(this).children('.add-choice').addClass('choiceDisable');
                  	$(this).children('.add-choice').text("备选已满");
                  }
               
               }
            );
            
            $(".showNumber").on("mouseout",".numberList li",function(){
               
                  $(this).removeClass('full');
                  $(this).removeClass('borderDisable');
                  $(this).children('.add-choice').removeClass('choiceDisable');
                  if(!$(this).hasClass('sselect')){
               	     $(this).children('.add-choice').text("加入备选");
                  }
               
               }
	        );

            $(".skipBtn").hover(function(){
                  $(this).css("background-position","-101px -200px");
            },function(){
                  $(this).css("background-position","-101px -178px");
            });
			
			$(".gotopage").click(function(){
				var z= /^[0-9]*$/;
				var t = $(".skipValue").val();
				
				if(z.test(t)&&t>0&&t<$(".numberList").length+1){
					$(".numberList").hide();
					$("#numberListNo"+t).show();
					$(".pageNum").removeClass('on');
					$(".pageNum").eq(t-1).addClass('on');
				}
				onOffPageNum();
				
				showFivePages();
				$(".skipValue").val("");	
			});
			
            $(".pages").on("click",".pageNum",function() {
            	$(".pageNum").removeClass('on');
            	var i = $(this).text();
            	$(this).addClass('on');
            	$(".numberList").hide();
            	$("#numberListNo"+i).show();
            	
            	onOffPageNum();
            	
            	showFivePages();
            });

            function onOffPageNum(){
            	var i ;
            	for(var j=0;j<$(".pageNum").length;j++){
            		if($(".pageNum").eq(j).hasClass('on')){
            			i=j;
            			break;
            		}
            	}
            	
            	if(i==0){
            		$(".prePage").addClass('prePageDisabled');
            	}else{
            		$(".prePage").removeClass('prePageDisabled');
            	}
            	if(i==$(".pageNum").length-1){
            		$(".nextPage").addClass('nextPageDisabled');
            	}else{
            		$(".nextPage").removeClass('nextPageDisabled');
            	}
            	if($(".pages").html()==""){
            		
            		$(".prePage").addClass('prePageDisabled');
            		$(".nextPage").addClass('nextPageDisabled');
            	}
            	
            }
            
            function showFivePages(){
            	var i ;
            	for(var j=0;j<$(".pageNum").length;j++){
            		if($(".pageNum").eq(j).hasClass('on')){
            			i=j;
            			break;
            		}
            	}
            	
            	if(i<3){
            		$(".pageNum").hide();
            		$(".pageNum").eq(0).show();
            		$(".pageNum").eq(1).show();
            		$(".pageNum").eq(2).show();
            		$(".pageNum").eq(3).show();
            		$(".pageNum").eq(4).show();
            		
            		
            	}else if(i>$(".pageNum").length-4){
            		$(".pageNum").hide();
            		$(".pageNum").eq($(".pageNum").length-5).show();
            		$(".pageNum").eq($(".pageNum").length-4).show();
            		$(".pageNum").eq($(".pageNum").length-3).show();
            		$(".pageNum").eq($(".pageNum").length-2).show();
            		$(".pageNum").eq($(".pageNum").length-1).show();
            		
            		
            	}else{
            		$(".pageNum").hide();
            		$(".pageNum").eq(i-2).show();
            		$(".pageNum").eq(i-1).show();
            		$(".pageNum").eq(i).show();
            		$(".pageNum").eq(i+1).show();
            		$(".pageNum").eq(i+2).show();
            	}
            	
            }
            


            $(".prePage").click(function(){
            	var i = 0;
            	for(var j=0;j<$(".pageNum").length;j++){
            		if($(".pageNum").eq(j).hasClass('on')){
            			i=j;
            			break;
            		}
            	}
            	
            	if(i!==0){
            		$(".pageNum").removeClass('on');
            		$(".numberList").hide();
            	    $("#numberListNo"+i).show();
            	    i--;
            	    $(".pageNum").eq(i).addClass('on');
            	}
            	
            	onOffPageNum();
            	
            	showFivePages();
            	
            });

            $(".nextPage").click(function(){
            	var i = 0;
            	for(var j=0;j<$(".pageNum").length;j++){
            		if($(".pageNum").eq(j).hasClass('on')){
            			i=j;
            			break;
            		}
            	}
            	
            	if(i!==$(".pageNum").length-1){
            		$(".pageNum").removeClass('on');
            		$(".numberList").hide();
            	    i++;
            	    $(".pageNum").eq(i).addClass('on');
            	    i++;
            	    $("#numberListNo"+i).show();
            	}
            	
            	onOffPageNum();
            	
            	showFivePages();
            });

            
            function ajaxGetNumberJason(lwf){
            	  
			    var pNumberNum = lwf.Product;//每个号码单元
			    var arrayObjNumberType = new Array(); //筛选类型后数组
			    var arrayObjPriceInterval = new Array();//筛选价格后数组
			    var arrayObjKeySearch = new Array();//筛选关键字后数组
			    //筛选号码模块
			    var numberSearch = {
                        goodNumberType:$("#roleSel").val(),
                        numberPriceInterval:$("#preFeeSel").val(),
                        numberKeySearch:$("#keySearch").val()
                };
                 
			    for(var i = 0; i < pNumberNum.length; i++) {
			                  	 
			       switch (numberSearch.goodNumberType) {
			        
			        case (""):
			            arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        break;
			        
                    case ("AAAAA"):
                          var s = pNumberNum[i].phoneNumber;
                          var d = /(\d)\1{4}/;	
                          if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                          }
                        
				        
                        break;
                        
                    case ("AAAA"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /(\d)\1{3}/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                        
                    case ("ABCDE"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /01234|12345|23456|34567|45678|67890|09876|98765|87654|76543|65432|54321|43210|56789/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
				        
                        break;
                    
                    case ("ABCD"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /0123|1234|2345|3456|4567|5678|6789|7890|0987|9876|8765|7654|6543|5432|4321|3210/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                    
                    case ("AAA"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /(\d)\1{2}/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                    
                    case ("AABB"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /(\d)\1(\d)\2/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                        
                    case ("ABAB"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /(\d)(\d)\1\2/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                        
                    case ("ABC"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                    
                    case ("AA"):
                        var s = pNumberNum[i].phoneNumber;
                        var d = /(\d)\1/;
            	
				        if(d.test(s)){  
                          	
                          	  arrayObjNumberType = arrayObjNumberType.concat(pNumberNum[i]);
                        }
                        break;
                    
                    
                   }
			                  	 
			   }  //筛选完第一波得到arrayObjNumberType,然后继续筛选
			    
			    
			   for(var i = 0; i < arrayObjNumberType.length; i++) { 
			    
			       switch (numberSearch.numberPriceInterval) {
			        
			        case ("0"):
			            arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        break;
			        
                    case ("1"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)<100&&parseInt(s)>=0){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]); 
                        	
                        }
                        break;
                        
                    case ("2"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)>=100&&parseInt(s)<200){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        	
                        }
                        break;
                        
                    case ("3"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)>=200&&parseInt(s)<300){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        	
                        }
                        break;
                    
                    case ("4"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)>=300&&parseInt(s)<400){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        	
                        }
                        break;
                    
                    case ("5"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)>=400&&parseInt(s)<500){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        	
                        }
                        break;
                    
                    case ("6"):
                        var s = arrayObjNumberType[i].numberPrice;
                        
            	
				        if(parseInt(s)>=500){
				        
                        	arrayObjPriceInterval = arrayObjPriceInterval.concat(arrayObjNumberType[i]);
                        	
                        }
                        break;
                        
                    
                   }
			       
			   }
			     
			   
			   	
			   if(numberSearch.numberKeySearch!=="2-4位数字"){
			       	   
			       	    var s = numberSearch.numberKeySearch;
                        var d = /^\d{2}$|^\d{3}$|^\d{4}$/; 
			       	    
			       	    if(d.test(s)){
				            
                          for(var i = 0; i < arrayObjPriceInterval.length; i++) { 
                              
                              var str = arrayObjPriceInterval[i].phoneNumber;
                              var patt1 = new RegExp(s);
                              
                              if(patt1.test(str)){
                            	
                            	  arrayObjKeySearch = arrayObjKeySearch.concat(arrayObjPriceInterval[i]);
                            	     
                              }	
                          }   
                        	
                        }else{
                        	
                        	alert("请输入2-4位数字");
                        	
                        }
			       	  
			   }else{
			       	
			       	for(var i = 0; i < arrayObjPriceInterval.length; i++) { 
                            		
                        arrayObjKeySearch = arrayObjKeySearch.concat(arrayObjPriceInterval[i]);
                            	     
                    }  
			       	
			   }
			                  	 
			                 	 
			                  	 
			                  	
 
			                   
			                   
			                   //筛选号码模块
			                   
			                   var pageTotal = Math.ceil(arrayObjKeySearch.length/16);
			                   $(".totalPages").text("共"+pageTotal+"页");
			                   var integerTotal = parseInt(arrayObjKeySearch.length/16);
			                   
			                   var lastPage = arrayObjKeySearch.length%16;
			                   
			                   var listInfoStr="";
			                   
			                   for(var i = 1; i < pageTotal+1; i++) {
			                   	     var listId = "numberListNo"+i;
			                   	     listInfoStr += "<ul id=\""+listId+"\" class=\"numberList\"><\/ul>\n";
			                   	     
			                   }
			                   $(".showNumber").html(listInfoStr);
			                   for(var i = 1; i < integerTotal+1; i++) {
			                   	     var liInfoStr="";
			                         for(var j = 1; j < 17; j++) {
			                         	 
			                         	 liInfoStr += "<li class=\"li\"><p class=\"pNumber\"><\/p><p class=\"numberPrice\" monthfee=\"0\"><span><\/span><span><\/span><\/p><span class=\"add-choice\">加入备选<\/span> <input type=\"hidden\" class=\"J_numMemo\" value=\"\"> <input type=\"hidden\" class=\"J_numPreFee\" value=\"\"> <input type=\"hidden\" class=\"J_numIsNiceRule\" value=\"\"> <input type=\"hidden\" class=\"J_numLevel\" value=\"\"> <input type=\"hidden\" class=\"J_monFee\" value=\"\"> <input type=\"hidden\" class=\"J_monTime\" value=\"\"> <input type=\"hidden\" class=\"J_numHuiFlag\" value=\"\"><\/li>\n";
			                         	
			                         }
			                         $("#numberListNo"+i).html(liInfoStr);
			                   }
			                   var lastInfoStr = "";
			                   for(var i = 1; i < lastPage+1; i++) {
			                   	     
			                        lastInfoStr += "<li class=\"li\"><p class=\"pNumber\"><\/p><p class=\"numberPrice\" monthfee=\"0\"><span><\/span><span><\/span><\/p><span class=\"add-choice\">加入备选<\/span> <input type=\"hidden\" class=\"J_numMemo\" value=\"\"> <input type=\"hidden\" class=\"J_numPreFee\" value=\"\"> <input type=\"hidden\" class=\"J_numIsNiceRule\" value=\"\"> <input type=\"hidden\" class=\"J_numLevel\" value=\"\"> <input type=\"hidden\" class=\"J_monFee\" value=\"\"> <input type=\"hidden\" class=\"J_monTime\" value=\"\"> <input type=\"hidden\" class=\"J_numHuiFlag\" value=\"\"><\/li>\n";
			                   	     
			                   }
			                   $("#numberListNo"+pageTotal).html(lastInfoStr);
			                   
			                   for(var i = 0; i < arrayObjKeySearch.length; i++) {
			                   	    
			                   	    
			                   	    var s = arrayObjKeySearch[i].phoneNumber;
                                    var c1 = s.substr(0,3);
                                    var c2 = s.substr(3,4);
                                    var c3 = s.substr(7,4);
                                    $(".li").eq(i).children(".pNumber").html(c1+"&nbsp;&nbsp;&nbsp;"+c2+" "+c3);
                                    $(".li").eq(i).children(".numberPrice").children("span").eq(0).text("￥"+arrayObjKeySearch[i].numberPrice);
                                    if(arrayObjKeySearch[i].numberPreFee!==0){
                                        $(".li").eq(i).children(".numberPrice").children("span").eq(1).text("含"+arrayObjKeySearch[i].numberPreFee+"元话费");
                                    }
                                    
                                    $(".li").eq(i).children(".J_numMemo").attr("value",arrayObjKeySearch[i].numberMemo);
                                    
			                   }
			                   var pageInfoStr = "";
			                   $(".pages").html("");
			                   if(pageTotal!==0){
			                   	  for(var i = 1; i < pageTotal+1; i++) {
			                         if(i==1){
			                         	pageInfoStr += "<a href=\"javascript:void(0);\" class=\"pageNum on\" pagenumber=\"1\">1<\/a>\n";
			                         }else{
			                         	var StrPart = "<a href=\"javascript:void(0);\" class=\"pageNum\" pagenumber=\""+i+"\">"+i+"<\/a>\n";
			                         	pageInfoStr += StrPart;
			                         	
			                         }
			                      }
			                   	  $(".pages").html(pageInfoStr);
			                   	  
			                   }
			                   if(pageTotal>1){
			                      $(".nextPage").removeClass('nextPageDisabled');
			                   
			                   }
			                   
			                   onOffPageNum();
			                   showFivePages();//处理函数放在succes包里面
			                   
			                   if($(".showNumber").html()==""){
			                   	
			                   	   $(".showNumber").html("<p class=\"noneShow\">没有符合条件的号码!<\/p>")           
			                   	
			                   }
			                   
			                   addOrangeColor();
			                   
			                   refreshAddSelect();
            	
            }
            
            $(".sh").click(function(){
            	
            	alert($(".pNumber .orangeTail").length);
            	alert($("#keySearch").val().length);
            	
            });
            
            function addOrangeColor(){
            	
            	var s = $("#keySearch").val();
                var e = /^\d{2,4}$/; 
			       	    
			    if(e.test(s)){
            	
            	
            	   for(var i = 0; i < $(".numberList li").length; i++) {
            	
            	      var d = $(".numberList li").eq(i).children(".pNumber").text(); 
                      var p1 = d.substr(0,3);
                      var p2 = d.substr(6,4);
                      var p3 = d.substr(11,4);
                    
                      var s = $("#keySearch").val();
                      var patt = new RegExp(s,"g");
                      var result;

                      while ((result = patt.exec(p3)) != null)  {
                          if(patt.lastIndex == 4){
                        	 
                        	 var m = s.length;
                        	 var n = 4 - m;
                        	 var p4 = p3.substr(0,n);
                        	 
                        	 $(".numberList li").eq(i).children(".pNumber").html(p1+"&nbsp;&nbsp;&nbsp;"+p2+" "+p4+"<span class=\"orangeTail\">"+s+"<\/span>");
                        	 
                          }
                        
                      }
                    
            	   }
            	
                }
            	
            }
            
            
            
            function refreshAddSelect(){
				
				var s1 = $(".choice-list .chosen").eq(0).children(".pNumber").text();
				var s2 = $(".choice-list .chosen").eq(1).children(".pNumber").text();
				var s3 = $(".choice-list .chosen").eq(2).children(".pNumber").text();
                
                for(var i=0;i<$(".numberList .li").length;i++){
                	
                    var d = $(".numberList .li").eq(i).children(".pNumber").text();
                    var p1 = d.substr(0,3);
                    var p2 = d.substr(6,4);
                    var p3 = d.substr(11,4);
                    var cc = p1+" "+p2+" "+p3;
                    
                    if(cc==s1|cc==s2|cc==s3){
                    	
                    	$(".numberList .li").eq(i).addClass('sselect');
                    	$(".numberList .li").eq(i).children(".add-choice").text("取消备选");
            	
                    }

                }
            
            
            }
















});


            














